<template>
<div class="ui form">
	<tFields @onsubmit="onsubmit" @oncancel="oncancel" @onchange="onchange" :data="fileds" :nosubmit='nosubmit'></tFields>
</div>
</template>
<script>
import tool from 'src/util/tool';
import util from '_util/index';
import logic from '_logic';

import tTable from 'components/tunit/tTable';
import tFields from 'components/tunit/tFields';

// import latlonMap from 'components/tunit/tmodel/latlonMap';

export default {
    data() {
        return {
			nosubmit:true,
			submitData:{
				name:'',//姓名
				uname:'',//对接人姓名
				city_code:'',//城市
				tags:'',//场景标签
				fws_id:'',//服务商id
				saas_id:'',//招募人id
			},
            fileds: [{
				label: "名称",
				show_type: "input",
				name: "name",
				value:''
			},
			{
				label: "对接人姓名",
				show_type: "input",
				name: "uname",
				value:''
			},
			{
				label: "城市",
				show_type: "city",
				citys:'',
				name: "city_code",
				"city_type": 0,
				"bind_type": 0,
				"eidit_type": 4,
				"data_type": 1,
				"showType": 1,
				value:''
			},
			{
				label: "标签",
				show_type: "bind",
				name: "tags",
				"bindModel": 46,
				"data_type": 1,
				"bind_type": 1,
				"bind_param":`isSearch=1`,
				"bind_name_field":"tags_names",
				value:''
			},
			{
				label: "服务商",
				show_type: "bind",
				name: "fws_id",
				"bindModel": 15,
				"data_type": 1,
				"bind_type": 0,
				"bind_param":'type=1&isSearch=1',
				"bind_name_field":"fws_name",
				value:''
			},
			{
				label: "Sass招募人",
				show_type: "bind",
				name: "saas_id",
				"bindModel": 15,
				"data_type": 1,
				"bind_type": 0,
				"bind_param":`isSearch=1`,
				"bind_name_field":"saas_name",
				value:''
			}]
        }
    },
    computed: {
    },
    components: {
        tTable,
        tFields,
    },
    watch: {},
    methods: {
        onclickBtn({
            type,
            rowIndex,
            tableName
        }) {

        },
        onchange({
            name,
            value
        }) {
			value = Array.isArray(value)?value.join('|'):value
            this.submitData[name] = value;
			this.$emit("onchange", {
				name:name,
				data:value
			});
        },
        onsubmit(form) {

        },
        oncancel() {

        },
    },
    props: {
        params: {
            type: Object,
            default: function() {
                return {}
            }
        },
        op: '',
    },
    created() {
		Object.keys(this.submitData).forEach(item=>{
			this.submitData[item] = this.params[item]
		})
		this.fileds.forEach(item=>{
			if(item.name == 'city_code'){
				item.citys = item.value = this.params[item.name]
			}else{
				if(item.show_type == 'bind'){
					let f = this.params[item.name]
					item.value = Array.isArray(f)?f.join('|'):f
				}else{
					item.value = this.params[item.name]
				}
			}
		})
    },
}
</script>
<style scoped lang="less">
@import "../../../common/style/mixin";

.ui.form .filed {
    margin-bottom: 10px;
}

.ui.table {
    width: auto;
}

.search-items {
    max-height: 100px;
    width: 250px;
    border: 1px solid rgba(34, 36, 38, .1);
    overflow: auto;
    padding: 0;
    &-item {
        margin: 0;
        padding: 0;
        list-style: none;
        padding: 10px;
        font-size: 12px;
        &:hover {
            background-color: rgba(34, 36, 38, .1);
        }
    }
}
</style>
